class HttpException extends Error {
    constructor(msg="服务器异常",errorCode=10001, status=400) {
        super()
        this.msg = msg
        this.errorCode = errorCode
        this.status = status
    }
}

class ParameterException extends HttpException {
    constructor(msg, errorCode) {
        super()
        this.status = 400
        this.msg = msg || '参数错误'
        this.errorCode = errorCode || 10000
    }
}

class SuccessException extends HttpException {
    constructor(msg, errorCode=0) {
        super()
        this.msg = msg || '数据请求成功'
        this.errorCode = errorCode
        this.status = 200
    }
}

module.exports = {
    HttpException,
    ParameterException,
    SuccessException
}